﻿Imports Utilidades
Imports Excepciones
Imports Negocio
Imports Servicios

Public Class frmEditIdioma

    Private _idioma As New Idioma()

    Sub New()
        InitializeComponent()
    End Sub
    Sub New(idioma As Idioma)
        Me.New()
        _idioma = idioma
    End Sub

    Protected Overrides Sub PreLoad()
        Me.Icon = Icon.FromHandle(Global.SIPRO.My.Resources.Resources.Language.GetHicon())
    End Sub

    Private Sub frmEditIdioma_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        dgvContenedores.AutoGenerateColumns = False
        dgvControles.AutoGenerateColumns = False
        dgvMensajes.AutoGenerateColumns = False
        Init()
    End Sub

    Private Sub Init()
        dgvContenedores.DataSource = _idioma.Contenedores
        dgvMensajes.DataSource = _idioma.Mensajes

    End Sub

    Private Sub dgvContenedores_MouseClick(sender As System.Object, e As System.EventArgs) Handles dgvContenedores.Click

        If TypeOf dgvContenedores.CurrentRow.DataBoundItem Is Contenedor Then
            Dim cont As Contenedor = DirectCast(dgvContenedores.CurrentRow.DataBoundItem, Contenedor)
            dgvControles.DataSource = cont.Controles
        Else
            My.Application.HandlerException(New ItemSelectRequiredException())
        End If
    End Sub

    Private Sub btnCerrar_Click(sender As System.Object, e As System.EventArgs) Handles btnCerrar.Click
        Me.Close()
    End Sub
End Class